package com.jivesoftware.forum.model;


public class ForumMessageBean
{

	private long iD;

	private long creationDate;

	private long modifiedDate;

	private long forumThread;

	private String subject;

	private String body;

	private String user;

	private int moderationValue;

	/**
	 * Returns the id of the message.
	 * 
	 * @return the unique id of the message.
	 */
	public long getID()
	{
		return iD;
	}

	public void setID(long iD)
	{
		this.iD = iD;
	}

	/**
	 * Returns the date the message was created.
	 * 
	 * @return the date the message was created.
	 */
	public long getCreationDate()
	{
		return creationDate;
	}

	/**
	 * Sets the creation date of the message. In most cases, the creation date
	 * will default to when the message was entered into the system. However,
	 * the creation date needs to be set manually when importing messages. In
	 * other words, skin authors should ignore this method since it only
	 * intended for system maintenance.
	 * 
	 * @param creationDate
	 *            the date the message was created.
	 * 
	 */
	public void setCreationDate(long creationDate)
	{
		this.creationDate = creationDate;
	}

	/**
	 * Returns the date the message was last modified. When a message is first
	 * created, the date returned by this method is identical to the creation
	 * date. The modified date is updated every time a message property is
	 * updated, such as the message body.
	 * 
	 * @return the date the message was last modified.
	 */
	public long getModifiedDate()
	{
		return modifiedDate;
	}

	/**
	 * Sets the date the message was last modified. In most cases, last modifed
	 * will default to when the message data was last changed. However, the last
	 * modified date needs to be set manually when importing messages. In other
	 * words, skin authors should ignore this method since it only intended for
	 * system maintenance.
	 * 
	 * @param modifiedDate
	 *            the date the message was modified.
	 */
	public void setModifiedDate(long modifiedDate)
	{
		this.modifiedDate = modifiedDate;
	}

	/**
	 * Returns the message subject. If message filters are active, the subject
	 * returned will be a filtered one. Because filters often provide security
	 * functionality, this method is the preferred way to get the subject of a
	 * message.
	 * 
	 * @return the subject of the message.
	 */
	public String getSubject()
	{
		return subject;
	}

	/**
	 * Sets the subject of the message.
	 * 
	 * @param subject
	 *            the subject of the message.
	 */
	public void setSubject(String subject)
	{
		this.subject = subject;
	}

	/**
	 * Returns the message body. If message filters are active, the body
	 * returned will be a filtered one. Because filters often provide security
	 * functionality such as stripping out HTML and Javascript, this method is
	 * the preferred way to get the body of a message.
	 * 
	 * @return the body of the message.
	 */
	public String getBody()
	{
		return body;
	}

	/**
	 * Sets the body of the message.
	 * 
	 * @param body
	 *            the body of the message.
	 */
	public void setBody(String body)
	{
		this.body = body;
	}

	/**
	 * Returns the User that authored the message. If the message was created
	 * anonymously, the Anonymous User object will be returned.
	 * 
	 * @return the author of the message.
	 */
	public String getUser()
	{
		return user;
	}

	public void setUser(String user)
	{
		this.user = user;
	}

	/**
	 * Returns the thread the message belongs to.
	 * 
	 * @return the thread the message belongs to.
	 */
	public long getForumThread()
	{
		return forumThread;
	}

	public void setForumThread(long forumThread)
	{
		this.forumThread = forumThread;
	}

	/**
	 * Returns the number of moderation points the message has. The default
	 * moderation value is inherited from the forum.
	 * <p>
	 * 
	 * If the moderation value is less than the forum's minimum, then the
	 * message will not be displayed by default.
	 * 
	 * @return the number of moderation points the message has.
	 */
	public int getModerationValue()
	{
		return moderationValue;
	}

	/**
	 * Sets the number of moderation points the message has. If the moderation
	 * value is less than the forum's minimum, then a number of things will
	 * happen:
	 * <ul>
	 * <li>The message will not be visible in the thread by default.
	 * <li>The thread and forum of the message will not have their modified
	 * date's updated.
	 * <li>The message will not be exported to installed gateways.
	 * <li>Watch updates will not be triggered.
	 * </ul>
	 * <p>
	 * 
	 * When calling this method results in a message to go from below the
	 * forum's minimum moderation threshold to above, then the actions listed
	 * above will all be executed. Any change of the moderation value also
	 * results in the modified date of the message being updated.
	 * <p>
	 * 
	 * Only administrators and moderators can call this method. The two types of
	 * moderators are thread moderators and message moderators. Either type of
	 * moderator can call this method since a thread moderator is also
	 * automatically a message moderator.
	 * <p>
	 * 
	 * The authorization token of the user must be passed into this method as a
	 * paramater for moderation auditing purposes.
	 * 
	 * @param value
	 *            the number of moderation points for the message.
	 * @param auth
	 *            the Authorization token of the user that is making the
	 *            moderation decision.
	 */
	public void setModerationValue(int value)
	{
		moderationValue = value;
	}

}
